package com.city.repository.party;

import com.city.domain.party.PartyBranch;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface PartyBranchRepository extends JpaRepository<PartyBranch,Integer>{


    //分页查询
    @Query(value = "select * from party_branch limit ?1,?2",nativeQuery = true)
    List<PartyBranch> findAllPartyBranch(Integer page, Integer limit);

    //模糊查询
    @Query(value = "select * from party_branch  where branch_name like %?1%  limit ?2,?3",nativeQuery = true)
    List<PartyBranch> findAllByNameAndPage(String branchName,Integer page,Integer limit);

    //根据组织名类别统计记录数
    @Query(value = "SELECT count(*) from party_branch where branch_name like %?1%",nativeQuery = true)
    long countName(String branchName);

}
